local qunxian3__hanniba_shicai = fk.CreateSkill {
  name = "qunxian3__hanniba_shicai",
}

Fk:loadTranslationTable {
  ["qunxian3__hanniba_shicai"] = "食材",
  [":qunxian3__hanniba_shicai"] = "当一名角色死亡后，你根据其体力上限数量与技能个数，每5个按顺序依次获得〖头部〗，〖四肢〗，〖内脏〗，〖坤〗，所有标记在下一轮开始时失去。",
  ["@qunxian3__hanniba_shicai_nums-round"] = "食材"
}

qunxian3__hanniba_shicai:addEffect(fk.Deathed, {
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill("qunxian3__hanniba_shicai") and (target.maxHp > 0 or #target:getSkillNameList() > 0) and
        player:getMark("qunxian3__hanniba_shicai_nums-round") < 20
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local mark_nums = math.min(target.maxHp + #target:getSkillNameList(),
      20 - player:getMark("qunxian3__hanniba_shicai_nums-round"))
    room:addPlayerMark(player, "qunxian3__hanniba_shicai_nums-round", mark_nums)
    local marks = player:getTableMark("@qunxian3__hanniba_shicai_nums-round")

    if #marks < player:getMark("qunxian3__hanniba_shicai_nums-round") / 5 then
      local marks_trans = { "头", "肢", "脏", "坤" }
      local show_marks = table.filter(marks_trans, function(name, index, array)
        return table.indexOf(marks_trans, name) <= player:getMark("qunxian3__hanniba_shicai_nums-round") / 5
      end)
      room:setPlayerMark(player, "@qunxian3__hanniba_shicai_nums-round", show_marks)
    end
  end
})


return qunxian3__hanniba_shicai
